package container.iteraetor;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class TestSetIterator
{
    public static void main (String[] args)
    {
        Set<String> set = new HashSet<>();
        
        set.add("oldlu");
        set.add("chen");
        set.add("zhen");
        set.add("我");
        
        Iterator<String> iterator1 = set.iterator();
        while(iterator1.hasNext())
        {
            String str = iterator1.next();
            System.out.println(str);
        }
    
        System.out.println("--------------------------------");
        
        for(Iterator<String> iterator2 = set.iterator(); iterator2.hasNext();)
        {
            String str = iterator2.next();
            System.out.println(str);
        }
    }
}
